package com.tang.lts.core.nio;

import com.tang.lts.core.nio.channel.ChannelInitializer;
import com.tang.lts.core.nio.channel.NioChannel;
import com.tang.lts.core.nio.codec.CodecFactory;
import com.tang.lts.core.nio.codec.Decoder;
import com.tang.lts.core.nio.codec.Encoder;
import com.tang.lts.core.nio.config.NioClientConfig;
import com.tang.lts.core.nio.handler.EventHandler;
import com.tang.lts.core.nio.handler.Futures;

import java.net.InetSocketAddress;

/**
 * @author Tang
 * @classname NioClientTest
 * @description [  ]
 * @date 2022/5/16 15:09
 */
public class NioClientTest {

    public static void main(String[] args) {

        NioClientConfig clientConfig = new NioClientConfig();

        NioClient nioClient = new NioClient(clientConfig,new EventHandler(),new ChannelInitializer(){
            @Override
            protected Decoder getDecoder() {
                return CodecFactory.decoder;
            }

            @Override
            protected Encoder getEncoder() {
                return CodecFactory.encoder;
            }
        });

        Futures.ConnectFuture connectFuture = nioClient.connect(new InetSocketAddress("127.0.0.2", 8888));
        NioChannel channel = connectFuture.getChannel();
    }

}